﻿<?xml version="1.0" encoding="utf-8" ?>
<Recipe Name="NewValidator" xmlns="http://schemas.microsoft.com/pag/gax-core" xmlns:xi="http://www.w3.org/2001/XInclude" Bound="false">
  <DocumentationLinks>
    <Link Kind="Documentation" Caption="Creating Providers" Url="ms-help://MS.VSCC.v80/MS.VSIPCC.v80/ms.EntLib.2007Apr/EnterpriseLibrary/html/10-060-Creating_Providers.htm" />
    <Link Kind="Documentation" Caption="How To: Create a Typed Provider for an Enterprise Library Application Block" Url="ms-help://MS.VSCC.v80/MS.VSIPCC.v80/ms.EntLib.2007Apr/EnterpriseLibrary/html/10-080-How_To_Create_a_Typed_Provider_for_an_Enterprise_Library_Application_Block.htm" />
    <Link Kind="NextStep" Caption="Create Design-Time Provider Node" Url="recipe://CreateDesignTimeNode" />
  </DocumentationLinks>
  <xi:include href="../Common/CommonTypeAliases.xml"
				xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(/gax:Types)" />
  <Caption>New Validator (Typed)</Caption>
  <Description>Creates a typed validator and configuration class that extend the Validation Application Block.</Description>
  <HostData>
		<CommandBar Menu="ValidationApplicationBlockProject"/>
		<CommandBar Menu="ValidationApplicationBlockFolder"/>
	</HostData>
  <Arguments>
    <xi:include href="../Common/CommonProvider.xml"
        xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(gax:Recipe/gax:Arguments/gax:Argument)" />
		<Argument Name="EnterpriseLibraryReferences">
			<ValueProvider Type="Evaluator" Expression="Microsoft.Practices.EnterpriseLibrary.Common.dll,Microsoft.Practices.ObjectBuilder.dll,Microsoft.Practices.EnterpriseLibrary.Validation.dll" />
		</Argument>
		<Argument Name="ValidatorResources" Type="ProjectItem">
			<ValueProvider Type="ProjectItemByFullNameProvider" 
                     ProjectArgumentName="CurrentProject" 
                     ItemFullName="Resources.resx"
                     />
		</Argument>
		<Argument Name="DynamicProviderDataTemplate">
			<ValueProvider Type="ArgumentExpressionProvider" Expression="$TextTemplateBaseDirectory$ValidatorData.t4" />
		</Argument>
	</Arguments>
  <xi:include href="../Common/CommonProvider.xml"
      xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(gax:Recipe/gax:GatheringServiceData)" />
  <Actions>
		<Action   Name="CreateProviderInfo" 
              Type="CreateProviderInfo"
              RuntimeProviderRootType="Validator"
              RuntimeProviderBaseType="ValueValidator"
              RuntimeConfigurationBaseType="ValueValidatorData"
              ProviderDataSuffix="Data"
              NamespacesRuntime="Microsoft.Practices.EnterpriseLibrary.Validation.Validators"
							DefaultRuntimeImplementationTemplate="$TextTemplateBaseDirectory$DefaultImplementations\Validator.t4"
							GenerateRuntimeConstructors="false"
							>
			<Input Name="Namespace" RecipeArgument="Namespace" />
      <Input Name="ExtendedNamespace" RecipeArgument="ExtendedNamespace" />
      <Input Name="ProviderName" RecipeArgument="ProviderName" />
			<Output Name="ProviderInfo" />
			<Output Name="DefaultRuntimeImplementationTemplate" />
		</Action>
    <xi:include href="../Common/CommonProvider.xml"
        xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(gax:Recipe/gax:Actions/gax:Action)" />
		<Action Name="AddNonNegatedDefaultMessageResource" Type="AddResource"  
				ResourceName="$ProviderName$NonNegatedDefaultMessage" 
				ResourceValue="Gets or sets the non negated default message." 
				RunCustomTool="false">
			<Input Name="Resources" RecipeArgument="ValidatorResources" />
		</Action>
		<Action Name="AddNegatedDefaultMessageResource" Type="AddResource"  
				ResourceName="$ProviderName$NegatedDefaultMessage" 
				ResourceValue="Gets or sets the negated default message.">
			<Input Name="Resources" RecipeArgument="ValidatorResources" />
		</Action>
		<Action Name="GenerateValidatorAttributeContent" 
			 Type="TextTemplateAction"
			 Template="$TextTemplateBaseDirectory$ValidatorAttribute.t4"
			 >
			<Input Name="ProviderInfo" ActionOutput="CreateProviderInfo.ProviderInfo"/>
			<Output Name="Content" />
		</Action>
		<Action Name="AddValidatorAttribute" 
			  Type="AddItemFromStringActionPromptingExistence" 
			  Open="true"  PromptForOverwriting="true" 
				TargetFileName="$ProviderName$Attribute.$LanguageFileExtension$">
			<Input Name="Item" RecipeArgument="CurrentFolder" />
			<Input Name="Content" ActionOutput="GenerateValidatorAttributeContent.Content" />
			<Input Name="Project" RecipeArgument="CurrentProject" />
			<Output Name="ProjectItem"/>
		</Action>
	</Actions>
</Recipe>
